package it.xiuxian.swindle.adapter

import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.fragment.app.FragmentPagerAdapter

class MyFragmentAdapter(fm: FragmentManager?, private val mFragments: List<Fragment>) :
    FragmentPagerAdapter(fm!!) {
    override fun getItem(position: Int): Fragment { //必须实现
        return mFragments[position]
    }

    override fun getCount(): Int { //必须实现
        return mFragments.size
    }

    override fun getPageTitle(position: Int): CharSequence?{ //选择性实现
        return mFragments[position].javaClass.simpleName
    }
}